home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / PowerPlant / CKT AGA 1.0 / LPrimaryGroupBox.cp < prev    next >
Encoding:
Text File  |  1996-05-09  |  1.8 KB  |  114 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        LPrimaryGroupBox.cp
  3.  
  4.     Contains:    Contains:    Apple Grayscale Appearance-savvy 
  5.                 primary group box pane.
  6.  
  7.     Copyright:    ©1996 Chris K. Thomas.  All Rights Reserved.
  8.  
  9.     Version:    1.0
  10. */
  11.  
  12. #include "LPrimaryGroupBox.h"
  13. #include "AGAColors.h"
  14.  
  15. //
  16. // • instance lifetime —————————————————————————————————————————————————————————————————————————
  17. //
  18.  
  19. LPrimaryGroupBox*
  20. LPrimaryGroupBox::CreatePrimaryGroupBoxStream(LStream *inStream)
  21. {
  22.     return new LPrimaryGroupBox(inStream);
  23. }
  24.  
  25. LPrimaryGroupBox::LPrimaryGroupBox()
  26. {
  27.  
  28. }
  29.  
  30.  
  31. LPrimaryGroupBox::LPrimaryGroupBox( const LGroupBox &inGroupBox)
  32. :LGroupBox(inGroupBox)
  33. {
  34.  
  35. }
  36.  
  37.  
  38. LPrimaryGroupBox::LPrimaryGroupBox( const SPaneInfo &inPaneInfo, Str255 inString, ResIDT inTextTraitsID)
  39. :LGroupBox(inPaneInfo, inString, inTextTraitsID)
  40. {
  41.  
  42. }
  43.  
  44.  
  45. LPrimaryGroupBox::LPrimaryGroupBox( LStream *inStream)
  46. :LGroupBox(inStream)
  47. {
  48.  
  49. }
  50.  
  51.  
  52. //
  53. // • imaging ———————————————————————————————————————————————————————————————————————————————————
  54. //
  55.  
  56.  
  57. void
  58. LPrimaryGroupBox::DrawText(
  59.     const Rect        &inRect)
  60. {
  61.     if(!IsEnabled())
  62.         ::RGBForeColor(&kColor7);
  63.     else
  64.         ::RGBForeColor(&kBlackColor);
  65.         
  66.     LGroupBox::DrawText(inRect);
  67. }
  68.  
  69. void
  70. LPrimaryGroupBox::DrawBorder( const Rect &inRect)
  71. {
  72.     const RGBColor    *darkColor;
  73.     const RGBColor    *lightColor;
  74.     Rect            r = inRect;
  75.     
  76.     if(IsEnabled())
  77.     {
  78.         darkColor = &kColor7;
  79.         lightColor = &kWhiteColor;
  80.     }
  81.     else
  82.     {
  83.         darkColor = &kColor4;
  84.         lightColor = &kColor1;
  85.     }
  86.     
  87.     //
  88.     // draw dark bits
  89.     //
  90.     
  91.     r.right -= 1;
  92.     r.bottom -= 1;
  93.     
  94.     ::RGBForeColor(darkColor);
  95.     ::FrameRect(&r);
  96.     
  97.     r.right += 1;
  98.     r.bottom += 1;
  99.     
  100.     //
  101.     // draw light bits
  102.     //
  103.     ::RGBForeColor(lightColor);
  104.     
  105.     ::MoveTo(r.left + 1, r.bottom - 3);    // left
  106.     ::LineTo(r.left + 1, r.top + 1);
  107.     ::LineTo(r.right - 3, r.top + 1);    // top
  108.     
  109.     ::MoveTo(r.right - 1, r.top);            // right
  110.     ::LineTo(r.right - 1, r.bottom - 1);
  111.     ::LineTo(r.left, r.bottom - 1);            // bottom
  112. }
  113.  
  114.